package com.zzz.algorithm;

import org.junit.Test;

public class Hanoi {

    private int count = 0;
    private int n = 5;
    private char[] cs = new char[n];
    char from='A', to='C', temp='B';
    public void move(char from,char to,char temp,int n){
        if(n==1){
            cs[0] = to;
            System.out.println(n+":"+from+"--->"+to+"-->"+(++count)+":"+ new String(cs));
            return;
        }
        move(from,temp,to,n-1);
        cs[n-1] = to;
        System.out.println(n+":"+from+"--->"+to+"-->"+(++count)+":"+ new String(cs));
        move(temp,to,from,n-1);
    }

    @Test
    public void test(){
        for (int i = 0; i < cs.length; i++) {
            cs[i] = from;
        }
        move(from,to,temp,n);
    }


    @Test
    public void test2(){
       int i = 3;
        System.out.println(1<<(i-1));
    }

}
